package com.hankol.material.api;

import com.baselibrary.net.result.HttpResult;
import com.hankol.material.bean.CreateFolderBean;
import com.hankol.material.bean.FolderDetailInfoBean;
import com.hankol.material.bean.FolderListBean;
import com.hankol.material.bean.LevelOneBean;
import com.hankol.material.bean.MaterialContentInfo;
import com.hankol.material.bean.MaterialHomeBean;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * @author zhanglijie
 * @description:
 * @date : 2021/05/13
 */
public interface MaterialApi {
    /**
     * //     * 获取热门搜索
     * //     *
     * //     * @param token
     * //     * @return
     * //
     */
    @FormUrlEncoded
    @POST("file/lib/list")
    Observable<HttpResult<MaterialHomeBean>> getMaterialHome(@Field("types") String types,
                                                             @Field("firstCid") int firstCid, @Field("secondCids") String secondCids,
                                                             @Field("page") int page);

    /**
     * 资料库分类
     *
     * @author: merbng
     * @time: 2021/11/4 13:54
     * @description:
     */
    @FormUrlEncoded
    @POST("file/lib/category")
    Observable<HttpResult<List<LevelOneBean>>> getCatalogueList( @Field("pid") long pid);


    @FormUrlEncoded
    @POST("collection/add")
    Observable<HttpResult<CreateFolderBean>> createFolder(@Field("name") String folderName);

    @POST("collection/list")
    Observable<HttpResult<List<FolderListBean>>> getFolderList();


    @FormUrlEncoded
    @POST("collection/add/file")
    Observable<HttpResult<CreateFolderBean>> addFileToFolder(@Field("fid") long fid, @Field("cid") long cid);

    @FormUrlEncoded
    @POST("collection/del")
    Observable<HttpResult<Boolean>> deleteFolder( @Field("cid") long cid);

    @FormUrlEncoded
    @POST("collection/update")
    Observable<HttpResult<Boolean>> renameFolder(@Field("name") String name, @Field("cid") long cid);

    @FormUrlEncoded
    @POST("collection/del/file")
    Observable<HttpResult<Boolean>> cancelCollection(@Field("cid") long cid, @Field("fid") long fid);

    @FormUrlEncoded
    @POST("collection/load")
    Observable<HttpResult<FolderDetailInfoBean>> loadFolderInfo(@Field("token") String token, @Field("cid") long cid, @Field("page") int page, @Field("type") int type);

    @FormUrlEncoded
    @POST("collection/transfer")
    Observable<HttpResult<Boolean>> loadMoverFolder(@Field("fid") long fid, @Field("newCid") long newCid, @Field("oldCid") long oldCid);

    //资料库查询
    @FormUrlEncoded
    @POST("file/lib/search")
    Observable<HttpResult<MaterialContentInfo>> reqCatalogueList(@Field("categoryId") long categoryId, @Field("page") int page, @Field("type") int type);

    //资料夹详情
    @FormUrlEncoded
    @POST("file/lib/search")
    Observable<HttpResult<MaterialContentInfo>> reqFolderList(@Field("collectionId") long collectionId, @Field("page") int page, @Field("type") int type);

    //搜索素材
    @FormUrlEncoded
    @POST("file/lib/search")
    Observable<HttpResult<MaterialContentInfo>> reqSearch(@Field("name") String name, @Field("page") int page, @Field("type") int type);

    //素材是否存在
    @FormUrlEncoded
    @POST("collection/file/load")
    Observable<HttpResult<Boolean>> reqMaterialAuthenticity(@Field("fid") long fid);
    //增加分享/下载数量
    @FormUrlEncoded
    @POST("file/lib/add/count")
    Observable<HttpResult<Object>> reqAddShareCount( @Field("fid") long fid, @Field("type") int type);

}
